package com.qh.book.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import com.qh.book.dataobj.BookImgs;
import com.qh.book.enums.ResultEnum;
import com.qh.book.exception.BsException;
import com.qh.book.repository.BookImgsRepository;
import com.qh.book.service.BookImgsService;

@Service
@Transactional
public class BookImgsServiceImpl implements BookImgsService {
	
	@Autowired
	private BookImgsRepository bookImgsRepository;

	@Override
	public List<BookImgs> findByBookId(String bookId) {
		List<BookImgs> ImgsList = bookImgsRepository.findByBookId(bookId);
		if(ImgsList.isEmpty()) {
			throw new BsException(ResultEnum.IMGS_ISEMPTY);
		}
		return ImgsList;
	}

}
